package com.jthinker.blog.service.impl;

import com.jthinker.blog.bean.entity.User;
import com.jthinker.blog.dao.BaseDao;
import com.jthinker.blog.dao.UserDao;
import com.jthinker.blog.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

/**
 * User: Gang Chen
 * Date: 2015/7/22 20:16
 */
@Service
public class UserServiceImpl extends BaseServiceImpl<User, Long> implements UserService
{
    private static final Logger LOGGER = LoggerFactory.getLogger(UserService.class);

    private UserDao userDao;

    @Autowired
    @Qualifier("userDao")
    @Override
    protected void setBaseDao(BaseDao<User, Long> baseDao)
    {
        this.baseDao = baseDao;
        this.userDao = (UserDao) baseDao;
    }

    @Override
    public User findByUsername(String username)
    {
        return userDao.findByUsername(username);
    }
}
